<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
	
<ui:composition template="/pages/template/padrao.xhtml">
<ui:define name="principal">
	<f:view>
	<center>
		<!-- Nova JogoSite -->
		<h:form>
			<h:commandLink value="Novo JogoSite" action="#{controlJogoSite.mostrarNovo}" />
		
			<h:form id="novoJogoSite" binding="#{controlJogoSite.formNovo}" rendered="false">
				<h:panelGrid columns="2">
					<h:outputText value="Site" />
					<h:selectOneMenu value="#{controlJogoSite.jogoSite.site.idSite}">
						<f:selectItems value="#{controlJogoSite.listaSites}"/>
					</h:selectOneMenu>
					
					<h:outputText value="Jogo" />
					<h:selectOneMenu value="#{controlJogoSite.jogoSite.jogo.idJogo}">
						<f:selectItems value="#{controlJogoSite.listaJogos}"/>
					</h:selectOneMenu>
					
					<h:outputText value="Valor" />
					<h:inputText id="valor" value="#{controlJogoSite.jogoSite.valor}" required="true" />
					
					<h:outputText value="Moeade" />
					<h:selectOneMenu value="#{controlJogoSite.jogoSite.moeda.idMoeda}">
						<f:selectItems value="#{controlJogoSite.listaMoedas}"/>
					</h:selectOneMenu>
					
					<h:outputText value="Usado" />
					<h:selectBooleanCheckbox value="#{controlJogoSite.jogoSite.usado}" />
				</h:panelGrid>
				<h:panelGroup>
					<h:commandButton value="Inserir" action="#{controlJogoSite.inserir}" />
				</h:panelGroup>
			</h:form>
		
			<h:messages />

			<!-- Lista de JogoSites -->
			<h:dataTable value="#{controlJogoSite.listaJogoSites}" var="js" border="1">
				<f:facet name="header">
					<h:outputText value="Valores" />
				</f:facet>
				<h:column>
					<f:facet name="header">
						<h:outputText value="Site" />
					</f:facet>
					<h:outputText value="#{js.site.nome}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value="Jogo" />
					</f:facet>
					<h:outputText value="#{js.jogo.nome}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value="Valor" />
					</f:facet>
					<h:outputText value="#{js.valor}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value="Moeda" />
					</f:facet>
					<h:outputText value="#{js.moeda.nome}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value="Usado" />
					</f:facet>
					<h:outputText value="#{js.usado}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value="Excluir" />
					</f:facet>
					<h:commandLink value="Excluir" action="#{controlJogoSite.excluir}">
						<f:setPropertyActionListener value="#{js}" target="#{controlJogoSite.jogoSite}"/>
					</h:commandLink>
				</h:column>
			</h:dataTable>
		</h:form>
		<h:outputLink value="#{facesContext.externalContext.requestContextPath}/pages/inicial.jsf" >
			<f:verbatim>Voltar</f:verbatim>
		</h:outputLink>
	</center>
	</f:view>
</ui:define>
</ui:composition>
</html>